<template>
	<view class="p-30">
		<view class="bg-white p-40 border-radius-lg box-shadow">
			<view class="text-center ft18 text-color-base">
				{{record.remarks}}
			</view>
			<view class="mt-40 text-center ftw600 ft32" :class="record.nums>0?'text-color-base':'text-color-warning'">
				{{record.nums}}
			</view>
			<view class="line mt-40 mb-40"></view>
			<view class="d-flex justify-content-between align-items-center mb-40 ft16">
				<view class="log-l text-color-grey">交易类型</view>
				<view class="log-r pl-20 text-color-base">{{record.event_label}}</view>
			</view>
			<view class="d-flex justify-content-between align-items-center mb-40 ft16">
				<view class="log-l text-color-grey">交易时间</view>
				<view class="log-r pl-20 text-color-base text-over">{{record.created_at}}</view>
			</view>
			<view class="d-flex justify-content-between align-items-center mb-40 ft16">
				<view class="log-l text-color-grey">交易号</view>
				<view class="log-r pl-20 text-color-base text-over">{{record.no}}</view>
			</view>
			<view class="d-flex justify-content-between align-items-center mb-40 ft16" v-if="record.event==99">
				<view class="log-l text-color-grey">到账金额</view>
				<view class="log-r pl-20 text-color-base">
					<view>{{record.withdraw.payment_amount}}元</view>
				</view>
			</view>
			<view class="d-flex justify-content-between align-items-center mb-40 ft16" v-if="record.event==99">
				<view class="log-l text-color-grey">手续费用</view>
				<view class="log-r pl-20 text-color-base">
					<view>{{record.withdraw.transfer_fee}}元</view>
				</view>
			</view>
			<view class="d-flex justify-content-between align-items-center mb-40 ft16" v-if="record.event==99">
				<view class="log-l text-color-grey">到账时间</view>
				<view class="log-r pl-20 text-color-base">
					<view>{{record.withdraw.payment_time}}</view>
				</view>
			</view>
			<view class="d-flex justify-content-between align-items-center mb-40 ft16" v-if="record.event==1">
				<view class="log-l text-color-grey">打赏金主</view>
				<view class="log-r pl-20 text-color-base d-flex align-items-center" @tap="jump('/pages/user/home?uuid='+record.reward_pay.user.uuid)">
					<cos-avatar :src="record.reward_pay.user.avatar" size="mini"></cos-avatar>
					<view>{{record.reward_pay.user.nickname}}</view>
				</view>
			</view>
			<view class="d-flex justify-content-between align-items-center mb-40 ft16" v-if="record.event==1">
				<view class="log-l text-color-grey">打赏作品</view>
				<view class="log-r pl-20 text-color-base" @tap="jump('/pages/post/detail?id='+record.reward_pay.post.id+'&type=album')">
					{{record.reward_pay.post.describe}}
				</view>
			</view>
			<view class="d-flex justify-content-between align-items-center mb-40 ft16">
				<view class="log-l text-color-grey">剩余金币</view>
				<view class="log-r pl-20 text-color-base">{{record.balances}}个</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default{
		data(){
			return {
				record_id:'',
				event:'',
				record:"",
			}
		},
		onLoad(options) {
			this.record_id = options.record_id;
			this.event     = options.event;
			this.getRecord();
		},
		methods:{
			async getRecord() {
				uni.showLoading({
					mask: true,
					title: '加载中'
				});
				//let res = await this.$api('album')
				this.record = "res.data";
				uni.hideLoading();	
			},
			jump(url) {
				uni.navigateTo({
					url:url
				})
			}
		}
	}
</script>

<style>
	.log-l{
		width: 140rpx;
	}
	.log-r{
		width: calc(100% - 140rpx);
	}
</style>